export default class Singleton {

    private static _instance: any = null;

    static Instance<T extends object>(this: new () => T): T {
        let c = <any>this;
        if (c._instance == null) {
            c._instance = new c();
            c._instance.onInit && c._instance.onInit()
        }
        return c._instance;
    }
}
